package com.xiaoxiong.mami.dao.mapperImpl;

import com.xiaoxiong.mami.dao.daomain.GoodsProperties;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * Created by Administrator on 2017/8/23.
 */
@Mapper
public interface GoodsPropertiesImpl {


    @Select("select id,goodsId,price,name from goods_properties where goodsId=#{goodsId}")
    public List<GoodsProperties> getGoodsPropertiesById(String goodsId);

    @Select("select id,price,name from goods_properties where goodsId=#{goodsId} and id=#{id}")
    public GoodsProperties getGoodsPropertyById(@Param("goodsId") String goodsId, @Param("id") int id);

    @Select("<script>"
            + "SELECT *  FROM goods_properties WHERE id IN "
            + "<foreach item='item' index='index' collection='propertyIdList' open='(' separator=',' close=')'>"
            + "#{item}"
            + "</foreach>"
            + "</script>")
    public List<GoodsProperties> getGoodsPropertiesByIds(@Param("propertyId") List<String> propertyIdList);


}
